﻿using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApp63.Models;

namespace WpfApp63
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableCollection<Clazz> clazzes = new ObservableCollection<Clazz>();
            clazzes.Add(new Clazz("一班", new ObservableCollection<Student>()
            {
                new Student(){Name = "张三"},
                new Student(){Name = "李四"},
                new Student(){Name = "王五"},
            }));

            clazzes.Add(new Clazz("二班", new ObservableCollection<Student>()
            {
                new Student(){Name="凤姐"},
                new Student(){Name="冠希"},
                new Student(){Name="芙蓉"},
            }));

            TvClass.ItemsSource = clazzes;


            //初始化TreeView 2
            TreeViewItem tvi = new TreeViewItem() { Header = "班级3" };
            tvi.Items.Add(new TreeViewItem() { Header = "Jeo" });
            tvi.Items.Add(new TreeViewItem() { Header = "Tom" });

            TvClass2.Items.Add(tvi);
            TreeViewItem tvi2 = new TreeViewItem() { Header = "班级4" };
            TvClass2.Items.Add(tvi2);
        }
    }
}